﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.View.c00_ndkzMenu.Default" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>c00_ndkz</title>
    <script src="/View/js/Alert.js" type="text/javascript"></script> 
    <script type="text/javascript">
        function SetWinData(index) {
            document.getElementById("Hid").value = c00_ndkz_MainStore.getAt(index).get('id');
            
			Txtbh.setValue(c00_ndkz_MainStore.getAt(index).get('bh'));
			Txtdqbm.setValue(c00_ndkz_MainStore.getAt(index).get('dqbm'));
			Txtmc.setValue(c00_ndkz_MainStore.getAt(index).get('mc'));
			Txtcs.setValue(c00_ndkz_MainStore.getAt(index).get('cs'));
			Txtje.setValue(c00_ndkz_MainStore.getAt(index).get('je'));
			Txtfdje.setValue(c00_ndkz_MainStore.getAt(index).get('fdje'));
			Txtbsbl.setValue(c00_ndkz_MainStore.getAt(index).get('bsbl'));
			Txtzt.setValue(c00_ndkz_MainStore.getAt(index).get('zt'));
			Txtbzxx.setValue(c00_ndkz_MainStore.getAt(index).get('bzxx'));
			Txtfabm.setValue(c00_ndkz_MainStore.getAt(index).get('fabm'));

            c00_ndkz_Win.show();
        }
    </script>
</head>
<body>
    <form id="MainForm" runat="server">
    <ext:ResourceManager ID="MainResourceMgr" runat="server" />
    <!--用来导出到Excel的数据源-->
    <ext:Hidden ID="ExcelGridData" runat="server" />
    <!--c00_ndkz表页面主数据元，自动生成-->
    <ext:Store runat="server" ID="c00_ndkz_MainStore" OnRefreshData="c00_ndkz_DataBind" AutoLoad="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="id">
                <Fields>
                    
					<ext:RecordField Name="id" />
					<ext:RecordField Name="bh" />
					<ext:RecordField Name="dqbm" />
					<ext:RecordField Name="mc" />
					<ext:RecordField Name="cs" />
					<ext:RecordField Name="je" />
					<ext:RecordField Name="fdje" />
					<ext:RecordField Name="bsbl" />
					<ext:RecordField Name="zt" />
					<ext:RecordField Name="bzxx" />
					<ext:RecordField Name="fabm" />

                </Fields>
            </ext:JsonReader>
        </Reader> 
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="limit" Value="15" Mode="Raw">
            </ext:Parameter>
        </BaseParams>
    </ext:Store>
    <!--c00_ndkz页面主表格-->
    <ext:Viewport ID="MainViewPort" runat="server">
        <Items>
            <ext:FitLayout>
                <Items>
                    <ext:GridPanel ID="c00_ndkz_Grid" Layout="fit" TrackMouseOver="true" runat="server" StoreID="c00_ndkz_MainStore"
                        StripeRows="true" Header="false" Border="false" Collapsible="true">
                        <TopBar>
                            <ext:Toolbar ID="MainToolBar" runat="server">
                                <Items>
                                    <ext:Button ID="BtnAdd" runat="server" Text="添加" Icon="Add">
                                        <Listeners>
                                            <Click Handler="#{c00_ndkz_MainForm}.getForm().reset();#{Hid}.setValue('');#{c00_ndkz_Win}.show();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="BtnDel" runat="server" Text="删除" Icon="Delete">
                                        <DirectEvents>
                                            <Click OnEvent="BtnDel_Click">
                                                <Confirmation ConfirmRequest="true" Title="确认" Message="确实要删除吗?" />
                                                <EventMask ShowMask="true" Msg="正在删除数据，请等候 ..." />
                                            </Click>
                                        </DirectEvents>
                                        <Listeners>
                                            <Click Handler="if(#{c00_ndkz_Grid}.getSelectionModel().getCount()<=0) {TellAlert('请选择要删除的记录');return false;}" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSeparator />
                                    <ext:Button ID="BtnReload" runat="server" Text="重新加载" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="#{c00_ndkz_MainStore}.reload();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarFill />
                                    <ext:Button ID="BtnToExcel" runat="server" Text="To Excel" AutoPostBack="true" OnClick="BtnSaveToExcel"
                                        Icon="PageExcel">
                                        <Listeners>
                                            <Click Handler="#{ExcelGridData}.setValue(Ext.encode(c00_ndkz_Grid.getRowsValues(false)));" />
                                        </Listeners>
                                        <ToolTips>
                                            <ext:ToolTip Title="将当前页内容存储为Excel文件">
                                            </ext:ToolTip>
                                        </ToolTips>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel ID="c00_ndkz_ColumnMode" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Width="20" />
                                <ext:Column Header="主键" Sortable="true" Hidden="true" DataIndex="id" />
                                
								<ext:Column Header="bh" Sortable="true" DataIndex="bh" />
								<ext:Column Header="dqbm" Sortable="true" DataIndex="dqbm" />
								<ext:Column Header="mc" Sortable="true" DataIndex="mc" />
								<ext:Column Header="cs" Sortable="true" DataIndex="cs" />
								<ext:Column Header="je" Sortable="true" DataIndex="je" />
								<ext:Column Header="fdje" Sortable="true" DataIndex="fdje" />
								<ext:Column Header="bsbl" Sortable="true" DataIndex="bsbl" />
								<ext:Column Header="zt" Sortable="true" DataIndex="zt" />
								<ext:Column Header="bzxx" Sortable="true" DataIndex="bzxx" />
								<ext:Column Header="fabm" Sortable="true" DataIndex="fabm" />

                            </Columns>
                        </ColumnModel>
                        <Listeners>
                            <RowDblClick Handler="SetWinData(rowIndex);" />
                        </Listeners>
                        <Plugins>
                            <ext:GridFilters runat="server" FiltersText="查找" ID="c00_ndkz_Filter">
                                <Filters>
                                    
								<ext:StringFilter DataIndex="bh" />
								<ext:StringFilter DataIndex="dqbm" />
								<ext:StringFilter DataIndex="mc" />
								<ext:StringFilter DataIndex="cs" />
								<ext:StringFilter DataIndex="je" />
								<ext:StringFilter DataIndex="fdje" />
								<ext:StringFilter DataIndex="bsbl" />
								<ext:StringFilter DataIndex="zt" />
								<ext:StringFilter DataIndex="bzxx" />
								<ext:StringFilter DataIndex="fabm" />

                                </Filters>
                            </ext:GridFilters>
                        </Plugins>
                        <LoadMask ShowMask="true" Msg="正在加载..." />
                        <SelectionModel>
                            <ext:CheckboxSelectionModel ID="CheckBoxGrid" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolBar" StoreID="c00_ndkz_MainStore" PageSize="15" runat="server" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:FitLayout>
        </Items>
    </ext:Viewport>
    
    <!--c00_ndkz表修改，添加主窗体-->
    <ext:Window ID="c00_ndkz_Win" Collapsible="true" Hidden="true" Modal="true"
        Maximizable="true" runat="server" Title="添加/修改记录" Icon="WorldEdit" Width="630" AutoHeight="true"
        Resizable="true">
        <Items>
            <ext:Hidden ID="Hid" runat="server">
            </ext:Hidden>
            <ext:FormPanel ID="c00_ndkz_MainForm" LabelWidth="65" Frame="true" runat="server"
                Border="false" Height="180" Padding="5" Icon="UserAdd" Layout="Column">
                <Items>
                    <ext:Panel runat="server" Border="false" Header="false" ColumnWidth=".5" Layout="Form">
                        <Items>
                            
							<ext:TextField ID="Txtbh" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="bh" />
							<ext:TextField ID="Txtmc" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="mc" />
							<ext:TextField ID="Txtje" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="je" />
							<ext:TextField ID="Txtbsbl" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="bsbl" />
							<ext:TextField ID="Txtbzxx" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="bzxx" />

                        </Items>
                    </ext:Panel>
                    <ext:Panel runat="server" Border="false" Header="false" ColumnWidth=".5" Layout="Form">
                        <Items> 
                            
							<ext:TextField ID="Txtdqbm" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="dqbm" />
							<ext:TextField ID="Txtcs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="cs" />
							<ext:TextField ID="Txtfdje" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="fdje" />
							<ext:TextField ID="Txtzt" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="zt" />
							<ext:TextField ID="Txtfabm" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="fabm" />

                        </Items>
                    </ext:Panel>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons> 
            <ext:Button Text="提交" ID="BtnSave" runat="server" Icon="Disk">
                <DirectEvents>
                    <Click OnEvent="BtnSave_Click">
                        <EventMask ShowMask="true" Msg="正在提交，请等候 ..."  />
                    </Click>
                </DirectEvents>
                <Listeners>
                    <Click Handler="if (#{c00_ndkz_MainForm}.getForm().isValid()) {;}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: '您填写的信息不正确，请您确认！', buttons:Ext.Msg.OK});return false;}" />
                </Listeners>
            </ext:Button>
            <ext:Button Text="取消" ID="BtnConcel" Icon="Delete">
                <Listeners>
                    <Click Handler="#{c00_ndkz_Win}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    </form>
</body>
</html>
